let vm = new Vue({
    el:'.main-container',  //选中整个main
    data() {
        return {
            page:{},
            condition:{
                description:'',
                type:''
            },
        }
    },
    methods: {
        selectPage: function (start = 1, pageSize = 5) {
            this.page = {};
            axios({
                url: `/guguanjia/manager/log/selectPage/${start}/${pageSize}`,
                params: this.condition
                //相对路径同样受到base标签影响
            }).then(
                response => {  //省略function关键字  自动传递上下文中的this
                    //this.apps = response.data.obj.list;
                    this.page = response.data.obj
                }
            ).catch(error => {
                console.log(error.message);
            })
        },

        selectAll: function () {
            //清空查询条件
            this.condition = {
                name: '',
                oid: ''
            };
            this.selectPage();
        },
        toUpdate: function (office) {
            layer.obj = office;
            layer.open({
                type: 2,
                title: '更新',
                maxmin: true,
                shadeClose: true, //点击遮罩关闭层
                area: ['80%', '90%'],
                content: 'office/update.html',
                end: () => {

                }
            });
        },
        todetil: function (log) {
            layer.obj = log;
            layer.open({
                type: 2,
                title: '详情',
                maxmin: true,
                shadeClose: true, //点击遮罩关闭层
                area: ['60%', '60%'],
                content: 'log/log-detail.html',
            });
        },
        deleteById:function (id) {
            layer.confirm('确认是否要删除？', {
                btn: ['是', '否'] //按钮
            }, () => {
                axios.put(`/guguanjia/manager/log/deleteById/${id}`).then(
                    (result) => {
                        if (result.data.success) {
                            layer.msg(result.data.msg);
                            this.selectPage(this.page.pageNum);
                        } else {
                            layer.msg("删除失败");
                        }
                    }
                ).catch((error) => {
                    layer.msg("删除失败");
                })
            }, function () {
                layer.msg("取消")
            });
        }
    },
    created:function () {
        this.selectPage();
        //console.log(this.page)
    }
});